from abc import ABC, abstractmethod
from typing import Generic, TypeVar
from django.db import models

M = TypeVar('M', bound=models.Model)

class BaseRepository(ABC, Generic[M]):
    model_class: M = None

    @abstractmethod
    def create(self, data: dict) -> M:
        pass

    @abstractmethod
    def get_by_id(self, id: int) -> M:
        pass

    @abstractmethod
    def update(self, id: int, data: dict) -> M:
        pass

    @abstractmethod
    def delete(self, id: int) -> bool:
        pass